package game.hero;

import game.exception.NoEnoughMpException;

public class Sword extends Hero {
	//体力值上线
		private static final int MAXHP=200;
		//魔法上线
		private static final int MAXMP=100;

	public Sword(String name,int power) {
		super(name,MAXHP, MAXMP,power);
	}

	@Override
	public int attack() {
		int power=getPower()+getWeapon().getAttack();
		System.out.println(getName()+"使用"+getWeapon().getAttack()+"长剑进行攻击");
		return power;
	}
	public int strick() throws NoEnoughMpException {
		if (getMp()<30) {
			throw new NoEnoughMpException("MP不足");
		}
		int basic=getPower()+getWeapon().getAttack();
		System.out.println(getName()+"使用独孤九剑进行攻击");
		setMp(getMp()-30);//扣除mp
		return basic*2;
	}
}
